package com.electronsys.emp.action;

import java.util.Date;
import java.util.List;

import com.electronsys.emp.service.EmpDaoService;
import com.electronsys.pojo.Department;
import com.electronsys.pojo.Employee;
import com.electronsys.pojo.Log;
import com.electronsys.pojo.Module;
import com.electronsys.pojo.ModuleContent;
import com.opensymphony.xwork2.ActionSupport;

public class FindEmpAllAction extends ActionSupport {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3062924781837317372L;
	public EmpDaoService empDaoService;

	public String getEmpName() {
		return empName;
	}

	public void setEmpName(String empName) {
		this.empName = empName;
	}



	public String getEmpSytle() {
		return empSytle;
	}

	public void setEmpSytle(String empSytle) {
		this.empSytle = empSytle;
	}

	public void setEmpDaoService(EmpDaoService empDaoService) {
		this.empDaoService = empDaoService;
	}

	public Integer empId;
	public String empName;
	public Integer empDeptId;
	public String empSytle;
	public List<Employee> listEmp;
	public List<Department> list;
	public Log log;


	public Integer getEmpId() {
		return empId;
	}

	public void setEmpId(Integer empId) {
		this.empId = empId;
	}

	public Integer getEmpDeptId() {
		return empDeptId;
	}

	public void setEmpDeptId(Integer empDeptId) {
		this.empDeptId = empDeptId;
	}

	public List<Employee> getListEmp() {
		return listEmp;
	}

	public void setListEmp(List<Employee> listEmp) {
		this.listEmp = listEmp;
	}

	public String execute(){
		
		listEmp = empDaoService.findEmpService(empId, empName, empDeptId, empSytle);
		list = empDaoService.deptService();
		
		Module module  = new Module(3003);
		ModuleContent moduleContent =new ModuleContent(5004);
		Employee employee = new Employee(1001);
         log = new Log();
		log.setLogDate(new Date());
		log.setModule(module);
		log.setModuleContent(moduleContent);
		log.setEmployee(employee);
		
		empDaoService.logEmp(log);
		return "success";
	}

	public List<Department> getList() {
		return list;
	}

	public void setList(List<Department> list) {
		this.list = list;
	}

}
